# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=tcpreplay
pkgver=4.4.4
pkgrel=0
pkgdesc="Replay captured network traffic"
url="https://tcpreplay.appneta.com/"
arch="all"
license="GPL-3.0-or-later"
makedepends="linux-headers libdnet-dev libpcap-dev tcpdump"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/tcpreplay/tcpreplay-$pkgver.tar.gz
	skip-tests-require-root.patch"

case "$CARCH" in
arm*)
	options="$options !check" # bus error
	;;
esac

# secfixes:
#   4.4.1-r0:
#     - CVE-2021-45386
#     - CVE-2021-45387
#   4.3.2-r0:
#     - CVE-2019-8381
#     - CVE-2019-8376
#     - CVE-2019-8377
#   4.3.4-r0:
#     - CVE-2020-24265
#     - CVE-2020-24266

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-dynamic-link \
		--enable-local-libopts \
		--disable-libopts-install
	make
}

check() {
	make -C test tcpprep
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
6af79836dbec2bc8e449e3a77f012765cbe4b3180075ffa0683e35b6440ccf12a36c75cff09b37805362e38202e8ad5b87affc126de618f6fe308e9c25c1afee  tcpreplay-4.4.4.tar.gz
b6491f1539d14721ab6cde567918fea857a3e230dad1b03dee872bc2c4cb8c8d86aa51d3ed08da322a5af3f6a508fab991d10d58c14e3c7ddd8aff971fe91abb  skip-tests-require-root.patch
"
